using Bddify.Reporters;
using NUnit.Framework;

namespace Bddify.Tests.Reporters
{
    public class WhenCreatingATagAndPassingInTheOpenTag : HtmlReportSpecs
    {
        private string _openingTag = "<div id='main'>";

        public override void Given()
        {
            SUT.TabCount = 2;
        }

        public override void When()
        {
            using (SUT.OpenTag(_openingTag, HtmlTag.div))
            {
                SUT.AddLine("<div id='id'>");
            }
        }

        [Test]
        public void ShouldIndentThePassedInOpenTag()
        {
            Assert.That(HtmlLines[0], Is.EqualTo("    " + _openingTag));
        }

        [Test]
        public void ShouldCloseTheTag()
        {
            Assert.That(HtmlLines[2], Is.EqualTo("    </div>"));
        }

        [Test]
        public void ShouldIndentTheContentInsideTheTag()
        {
            Assert.That(HtmlLines[1].StartsWith("      <"));
        }
    }
}